package com.jcfy.project.module.service.impl;

import java.util.List;
import com.jcfy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcfy.project.module.mapper.TSupplierMapper;
import com.jcfy.project.module.domain.TSupplier;
import com.jcfy.project.module.service.ITSupplierService;

/**
 * 供应商Service业务层处理
 *
 * @author jiangfeng
 * @date 2020-08-05
 */
@Service
public class TSupplierServiceImpl implements ITSupplierService {
    @Autowired
    private TSupplierMapper tSupplierMapper;

    /**
     * 查询供应商
     *
     * @param supplierId 供应商ID
     * @return 供应商
     */
    @Override
    public TSupplier selectTSupplierById(Long supplierId) {
        return tSupplierMapper.selectTSupplierById(supplierId);
    }

    /**
     * 查询供应商列表
     *
     * @param tSupplier 供应商
     * @return 供应商
     */
    @Override
    public List<TSupplier> selectTSupplierList(TSupplier tSupplier) {
        return tSupplierMapper.selectTSupplierList(tSupplier);
    }

    /**
     * 新增供应商
     *
     * @param tSupplier 供应商
     * @return 结果
     */
    @Override
    public int insertTSupplier(TSupplier tSupplier) {
        tSupplier.setCreateTime(DateUtils.getNowDate());
        return tSupplierMapper.insertTSupplier(tSupplier);
    }

    /**
     * 修改供应商
     *
     * @param tSupplier 供应商
     * @return 结果
     */
    @Override
    public int updateTSupplier(TSupplier tSupplier) {
        tSupplier.setUpdateTime(DateUtils.getNowDate());
        return tSupplierMapper.updateTSupplier(tSupplier);
    }

    /**
     * 批量删除供应商
     *
     * @param supplierIds 需要删除的供应商ID
     * @return 结果
     */
    @Override
    public int deleteTSupplierByIds(Long[] supplierIds) {
        return tSupplierMapper.deleteTSupplierByIds(supplierIds);
    }

    /**
     * 删除供应商信息
     *
     * @param supplierId 供应商ID
     * @return 结果
     */
    @Override
    public int deleteTSupplierById(Long supplierId) {
        return tSupplierMapper.deleteTSupplierById(supplierId);
    }
}
